
c
c
c
c     =====================================================
       subroutine qinit(maxmx,maxmy,meqn,mbc,mx,my,xlower,ylower,
     &                   dx,dy,q,maux,aux)
c     =====================================================
c
c     # Set initial conditions for q.
c     # Acoustics with smooth radially symmetric profile to test accuracy
c
       implicit double precision (a-h,o-z)
       dimension q(1-mbc:maxmx+mbc, 1-mbc:maxmy+mbc, meqn)
c
       pi = 4.d0*datan(1.d0)
       width = 0.1d0
       widthG = 0.01d0

       do 20 i=1,mx
          xcell = xlower + (i-0.5d0)*dx
          do 20 j=1,my
             ycell = ylower + (j-0.5d0)*dy
             
c            r1 = dabs( ycell - dsqrt(xcell) )
c            r2 = dabs( xcell - ycell**2 )
c            r = min(r1,r2)
             a  = 3*ycell**2
             b  = 3*xcell*ycell**2 + ycell
             y1 = b/(2.d0*a)
             y2 = dsqrt(3.d0) * dsqrt((27.d0*a*b**2+4.d0)/a) / (18.d0*a)
             y  = (y1+y2)**(1.d0/3.d0) - 1/(3.d0*a*(y1+y2)**(1.d0/3.d0))
             x  = y**3
             r  = dsqrt( (x-xcell)**2 + (y-ycell)**2 )

             pressure = 0.d0
             ux = 0.d0
             uy = 0.d0
             if (r .le. 3.d0*width) then
		if (ycell .ge. 0.d0) then
                   pressure = 1.d0 + dcos(pi*r/width)
c                   pressure = dexp(-1.d0 * r**2 / widthG)
c                   pressure = 1.d0
            ux = pressure/2.d0*1.d0/dsqrt(1.d0+9*ycell**4)			
            uy = pressure/2.d0*((-3.d0)*ycell**2)/dsqrt(1.d0+9*ycell**4)		
		endif
             endif
             q(i,j,1) = pressure
             q(i,j,2) = ux
             q(i,j,3) = uy
c             
  20         continue
       return
       end
